package com.example.week9.controller;

import com.example.week9.domain.Book;
import com.example.week9.domain.MyPage;
import com.example.week9.mapper.BookMapper;
import com.example.week9.service.BookService;
import com.example.week9.service.IBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class BookController {

    @Autowired
    private IBookService bookService;

    @GetMapping("/list")
    public void list(){
//        定义一个函数selectXXXList 返回类型List<>,
//        selectAllList函数功能为创建一个MyPage对象，设置成员total 为100，函数返回MyPage 对象
        List<Book> bookList = bookService.selectAllList();
//       调用函数selectXXXList ，从返回的List 对象中输出total 的值
        System.out.println(((MyPage<?>) bookList).getTotal());
    }
}
